package com.exam.serviceimpl;


import com.exam.entity.Message;
import com.exam.mapper.MessageMapper;
import com.exam.service.MessageService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceImpl implements MessageService {

    @Autowired
    private MessageMapper messageMapper;

    @Override
    public Page<Message> findAll(Integer pagenum,Integer size) {
        PageHelper.startPage(pagenum,size);
        Page<Message> page=this.messageMapper.findAll(pagenum,size);

        return page;
    }

    @Override
    public Message findById(Integer id) {
        return messageMapper.findById(id);
    }

    @Override
    public int delete(Integer id) {
        return messageMapper.delete(id);
    }

    @Override
    public int update(Message message) {
        return messageMapper.update(message);
    }

    @Override
    public int add(Message message) {
        return messageMapper.add(message);
    }
}
